]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
introspect: Include `sandboxed-app-id` as well
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 15 May 2019 22:57:27 +0000 (00:57 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Thu, 16 May 2019 13:02:08 +0000 (13:02 +0000)
App IDs in gnome-shell don't match AppStream, Flatpak or Snap IDs. For the
desktop portal, the latter two are more relevant, so include it in the
returned information.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1289

js/misc/introspect.js

index 3ff48b016fe036ca2d22cfa25fcbfb9be5c847de..1df124bdb56a6d6c1d1a8c95b8b422f0f13dade4 100644 (file)
@@ -53,6 +53,11 @@ var IntrospectService = class {
        return APP_WHITELIST.includes(sender);
     }
 
+    _getSandboxedAppId(app) {
+        let ids = app.get_windows().map(w => w.get_sandboxed_app_id());
+        return ids.find(id => id != null);
+    }
+
     _syncRunningApplications() {
         let tracker = Shell.WindowTracker.get_default();
         let apps = this._appSystem.get_running();
@@ -74,6 +79,10 @@ var IntrospectService = class {
                 newActiveApplication = app.get_id();
             }
 
+            let sandboxedAppId = this._getSandboxedAppId(app);
+            if (sandboxedAppId)
+                appInfo['sandboxed-app-id'] = new GLib.Variant('s', sandboxedAppId);
+
             newRunningApplications[app.get_id()] = appInfo;
         }
 
@@ -135,6 +144,7 @@ var IntrospectService = class {
                 let frameRect = window.get_frame_rect();
                 let title = window.get_title();
                 let wmClass = window.get_wm_class();
+                let sandboxedAppId = window.get_sandboxed_app_id();
 
                 windowsList[windowId] = {
                     'app-id': GLib.Variant.new('s', app.get_id()),
@@ -151,6 +161,10 @@ var IntrospectService = class {
 
                 if (wmClass != null)
                     windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass);
+
+                if (sandboxedAppId != null)
+                    windowsList[windowId]['sandboxed-app-id'] =
+                        GLib.Variant.new('s', sandboxedAppId);
             }
         }
         invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList]));